package com.dubbo.framework.protocol.dubbo;

import com.dubbo.framework.Invocation;
import com.dubbo.framework.URL;
import com.dubbo.framework.protocol.Protocol;

/**
 * dubbo 通讯协议 底层使用的netty
 *
 * @author by Mr. Li 2021/4/30 13:44
 */
public class DubboProtocol implements Protocol {

    @Override
    public void start(URL url) {
        NettyServer nettyServer = new NettyServer();
        nettyServer.start(url.getIpAddr(), url.getPort());
    }

    @Override
    public String send(URL url, Invocation invocation) {
        NettyClient client = new NettyClient();
        return client.send(url.getIpAddr(), url.getPort(), invocation);
    }
}
